package com.soft.javase.day10.review.log;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/5/4
 */
public class LogRecord {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        String format = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss").format(now);
        String type = "NullPointerException";
        String line = "LogRecord.java.66";

        testLogRecord(2,format+ "," +type+"," +line);
        testLogFunctionalInterface(3,()->System.out.println(format+ "," +type+"," +line));

    }

    public static void testLogRecord(int level,String message){
        if (level == 3){
            System.out.println(message);
        }
    }

    public static void testLogFunctionalInterface(int level, LogFunctionalInterface log){
        if (level == 3){
            log.record();
        }
    }
}
